package org.wz.complex.work.mapper.auth.sysinfo;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import org.apache.ibatis.annotations.Mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.wz.complex.work.entity.auth.sysinfo.SysinfoRole;

@Mapper
public interface SysinfoRoleMapper extends BaseMapper<SysinfoRole> {

    @Select("""
        SELECT id, name, code FROM auth_sysinfo_role WHERE id = (
        SELECT role_id FROM auth_sysinfo_user\s
        WHERE id = (SELECT user_id from auth_token_pclogin WHERE id = #{tokenId}  ) )
        LIMIT 1
    """)
    SysinfoRole roleByTokenId(@Param("tokenId") String tokenId);

}
